import Vue from 'vue'
import App from './App.vue'
import router from './router'
import axiosobj from '@/config/http'
import imgData from '@/assets/util.js'
console.log(imgData)
// 本地存储
import storage from '@/config/storage'
// Vuex
import store from './store'
import './config/directive'
Vue.config.productionTip = false
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import '@/assets/style/global.less'
Vue.use(ElementUI);
import progressive from 'progressive-image/dist/vue'; // 渐进式
 Vue.use(progressive, {
   	removePreview: true,
   	scale: true
 })
Vue.prototype.$request = axiosobj
Vue.prototype.$storage = storage
Vue.prototype.$imgData = imgData.imgData
Vue.prototype.$loadflag = false
Vue.prototype.$mypush = () => {
    this.$router.push({'path': '/collection'})
}


var obj = new Vue({
    router, store,
    render: h => h(App)
}).$mount('#app')

// 创建路由前置守卫，修改页面标题
router.beforeEach((to, form, next) => {
    if (to.meta.title) {
        document.title = to.meta.title
    }
    next()
})
router.afterEach((to, from) => {
    // console.log(to.matched[0].instances)
    // console.log(from)
    // console.log(obj.$children[0])
    // console.log(obj.$children[0].$children)
    // for(var k in obj.$children[0].$children){
    // 	console.log(obj.$children[0].$children[k])
    // }
    // to.matched[0].instances.default.$emit("closeloading")
    // // console.log(123)
})
